package org.elephas.webapp.frontend.component.common.form;

import org.apache.wicket.Component;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.model.Model;

public class ErrorHighlightBehavior extends AttributeAppender {
	private static final long serialVersionUID = 1L;

	public ErrorHighlightBehavior() {
		super("class", true, new Model("error"), " ");
	}

	@Override
	public boolean isEnabled(Component component) {
		return !((FormComponent) component).isValid();
	}
}
